package com.alks.function.data.request.stockdept.pcfactorystockwork;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author: chen
 * @date: 2024/11/12
 * @description: 成品收发库存操作请求参数
 */
@Data
@ApiModel(value = "成品收发库存操作请求参数")
public class FinishRecStoreRequest {

    @ApiModelProperty(value = "部门编号")
    private String deptNo;

    @ApiModelProperty(value = "配码")
    @NotNull(message = "配码必填，请核查！！！")
    private Integer groupNo;

    @ApiModelProperty(value = "指令")
    @NotBlank(message = "系统错误，指令号必填！！！")
    private String lotNo;

    @ApiModelProperty(value = "入库或出库数量")
    private Integer pairQty;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "出入库时间")
    private LocalDate collectTime;

    private String poNo;

    @ApiModelProperty(value = "打包方式")
    private List<PackType> packTypes;

    @ApiModelProperty(value = "柜号")
    private String containerNo;

    @ApiModelProperty(value = "发票号")
    private String invoiceNo;

    @ApiModelProperty(value = "海关编码")
    private String customsCode;

    /**
     * 操作方式  I 入库  O 出库
     */
    @JsonIgnore
    private String optType;

    public boolean inStore() {
        return "I".equals(this.optType);
    }

    @Data
    public static class PackType {

        @ApiModelProperty(value = "打包件数")
        private Integer caseQty;

        @ApiModelProperty(value = "打包方式")
        private String packType;
    }
}
